package StudyCode.summary.myfile;

import java.util.ArrayList;
import java.util.StringTokenizer;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class TokenizeFilePath {

	public static void main(String[] args) {
		for (String s : tokenizePath("/home/docs/status.txt")) {
			System.out.println(s);
		}
	}

	private static ArrayList<String> tokenizePath(String path) {
		path = path.replace('\\', '/');
		StringTokenizer tokenizer = new StringTokenizer(path, "/");
		ArrayList<String> tokens = new ArrayList<>();
		while (tokenizer.hasMoreTokens()) {
			tokens.add(tokenizer.nextToken());
		}
		return tokens;
	}
}
